#include <bits/stdc++.h>
using namespace std;
#define int long long


int n, mod, a[1004][1004], b[1004][1004], c[1004][1004];
mt19937 rnd(time(0));

signed main() {
	freopen("matrix.in", "w", stderr);
	ios::sync_with_stdio(0); cin.tie(0);
	int n = 301, mod = 147744151;
	cerr << 10 << "\n";
	for (int tc = 1; tc <= 10; ++tc) {
		cerr << mod << "\n" << n << "\n";
		for (int i = 1; i <= n; ++i) for (int j = 1; j <= n; ++j) a[i][j] = rnd() % mod;
		for (int i = 1; i <= n; ++i) for (int j = 1; j <= n; ++j) b[i][j] = rnd() % mod;
		for (int i = 1; i <= n; ++i) {
			for (int j = 1; j <= n; ++j) {
				int sum = 0;
				for (int k = 1; k <= n; ++k) {
					(sum += a[i][k] * b[k][j]) %= mod;
				}
				c[i][j] = sum;
			}
		}
		int posx = rnd() % n + 1, posy = rnd() % n + 1;
		if (tc <= 5) posx = 0;
		if (mod == 2) c[posx][posy] ^= 1;
		else c[posx][posy] = rnd() % mod;
		for (int i = 1; i <= n; ++i) {
			for (int j = 1; j <= n; ++j) {
				cerr << a[i][j] << " \n"[j == n];
			}
		}for (int i = 1; i <= n; ++i) {
			for (int j = 1; j <= n; ++j) {
				cerr << b[i][j] << " \n"[j == n];
			}
		}
		for (int i = 1; i <= n; ++i) {
			for (int j = 1; j <= n; ++j) {
				cerr << c[i][j] << " \n"[j == n];
			}
		}
		cout << tc << endl;
	}
	cout << "Data complete. Running..." << endl;
	system("./std");
	cout << "Ok.\n";
	system("cat matrix.out");
	return 0;
}
